<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="../assets/js/vue.js"></script>
    <title>vue的生命周期</title>
</head>
<body>
    <h1>VUE的声明周期</h1>
    <hr>
    <div id="app">
        <!-- 我们已经用的是{{xxx}},这种情况是有弊端的，就是当我们网速很慢或者javascript出错时，会暴露我们的{{xxx}}。 -->
       <div v-text="count"></div>
        <button @click="add">add</button>
    </div>
</body>
<script>
     var app = new Vue({
        el:"#app",
        data:{
            count:1,
        },
        methods:{
            add:function(){
                this.count++
            }
        },
        beforeCreate:function(){
            console.log("1、beforeCreate 初始化之后");
        },
        created:function(){ 
            console.log("2、created 创建完成");
        },
        beforeMount:function(){
            console.log("3、beforeMount 挂载之前");
        },
        mounted:function(){
            console.log("4、mounted挂载之后");
        },
        beforeUpdate:function(){
            console.log("5、beforeUpdate更新之前");
        },
        updated:function(){
            console.log("6、被更新之后");
        },
        activated:function(){
                console.log('7-activated');
        },
        deactivated:function(){
            console.log('8-deactivated');
        },
        beforeDestroy:function(){
            console.log('9-beforeDestroy 销毁之前'); //通过实例.$destory()进行实例的销毁
        },
        destroyed:function(){
            console.log('10-destroyed 销毁之后')
        }

    }) 
</script>
   
</html>